import axios from "axios"
import { config } from "../config/config.default"

//获取小程序的session_key
export const getSessionKey = (js_code) => {
    return new Promise((resolve, reject) => {
        axios.get(`https://api.weixin.qq.com/sns/jscode2session?grant_type=authorization_code&appid=${config.mini.appid}&secret=${config.mini.secret}&js_code=${js_code}`).then(response => {
            resolve(response.data)
        }).catch(err => {
            reject(err)
        })
    })
}